home *** CD-ROM | disk | FTP | other *** search
- Path: loki.tor.hookup.net!news
- From: Rajendra_Singh@msn.com (Rajendra Singh)
- Newsgroups: comp.lang.c
- Subject: Is This Bad Coding Practice?
- Date: Fri, 29 Mar 1996 16:19:03 GMT
- Organization: HookUp Communication Corporation, Oakville, Ontario, CANADA
- Message-ID: <4jgnt2$9d1@loki.tor.hookup.net>
- NNTP-Posting-Host: u36u400.tor.hookup.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- int main(int argc, char *argv[])
- {
- char string[128];
- char *func1(void);
-
- strcpy(string, func1());
- return 0;
- }
-
- char *func1(void)
- {
- char test[100];
-
- sprintf(test, "Test: %d", 1);
- return test;
- }
-
- ... since I am using the value returned from func1() immediately (in
- main()), is this reliable? After I copy it into "string", I won't be
- using that area of memory anymore (i. e. the pointer returned by
- func1()).
-
- ---
- Rajendra Singh, B. Sc. (Rajendra_Singh@msn.com)
- "What is understood need not be discussed." - Loren Adams
-
-